﻿using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class StartGame : MonoBehaviour {

    public GameController controller;
    void OnMouseDown() {
        
        if (PlayerPrefs.GetInt("MainsToken")>0)
        {
            PlayerPrefs.SetInt("MainsToken", PlayerPrefs.GetInt("MainsToken") - 1);
            FindObjectOfType<MainScenPanel>().RefreshToken();
            controller.StartGame();
        }
        else
        {
            if (transform.name!="replay")
            {
                FindObjectOfType<MainScenPanel>().TokenGetPanel.SetActive(true);
            }
            else
            {
                SceneManager.LoadScene("Start");
            }
           
        }
        
        
       
    }
}
